package org.jeecg.modules.yks.srv.service.impl;

import org.jeecg.modules.yks.dev.entity.DevEquipmentConfigProduct;
import org.jeecg.modules.yks.dev.entity.YksEquipmentConfigurationPart;
import org.jeecg.modules.yks.dev.mapper.DevEquipmentConfigProductMapper;
import org.jeecg.modules.yks.dev.mapper.YksEquipmentConfigurationPartMapper;
import org.jeecg.modules.yks.srv.entity.YksEquipmentDevopsMaterialDetail;
import org.jeecg.modules.yks.srv.entity.YksEquipmentDevopsProductDetail;
import org.jeecg.modules.yks.srv.mapper.YksEquipmentDevopsProductDetailMapper;
import org.jeecg.modules.yks.srv.service.IYksEquipmentDevopsProductDetailService;
import org.springframework.stereotype.Service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @Description: 产品运维表
 * @Author: jeecg-boot
 * @Date:   2024-01-16
 * @Version: V1.0
 */
@Service
public class YksEquipmentDevopsProductDetailServiceImpl extends ServiceImpl<YksEquipmentDevopsProductDetailMapper, YksEquipmentDevopsProductDetail> implements IYksEquipmentDevopsProductDetailService {

	@Autowired
	DevEquipmentConfigProductMapper devEquipmentConfigProductMapper;

	@Autowired
	private YksEquipmentDevopsProductDetailMapper yksEquipmentDevopsProductDetailMapper;
	
	@Override
	public List<YksEquipmentDevopsProductDetail> selectByMainId(String mainId) {
		List<YksEquipmentDevopsProductDetail> list = yksEquipmentDevopsProductDetailMapper.selectByMainId(mainId);
		for (YksEquipmentDevopsProductDetail item: list
		) {
			DevEquipmentConfigProduct cfg = devEquipmentConfigProductMapper.selectById(item.getPartConfigId());
			if (cfg != null) {
				item.setCheckGap(cfg.getCheckGap());
				item.setCheckDate(cfg.getCheckDate());
				item.setMaintenanceGap(cfg.getMaintenanceGap());
				item.setMaintenanceDate(cfg.getMaintenanceDate());
				item.setChangeGap(cfg.getChangeGap());
				item.setChangeDate(cfg.getChangeDate());
				item.setLocationNumber(cfg.getLocationNumber());
			}
		}
		return list;
	}
}
